import request from '@/utils/request'

// 1. 获取角色列表(分页)
export const reqGetRoleList = ({ page, pagesize }) => {
  return request.get('/sys/role', {
    params: {
      page,
      pagesize
    }
  })
}

// 2. 新增角色
export const reqAddRole = (data) => {
  return request.post('/sys/role', data)
}

// 3. 编辑角色
export const reqUpdateRole = (data) => {
  return request.put(`/sys/role/${data.id}`, data)
}

// 4. 根据id去删除角色
export const reqDelRole = (id) => {
  return request.delete(`/sys/role/${id}`)
}

// 5. 获取所有已启用的角色
export const reqGetEnabledRole = () => {
  return request.get('/sys/role/list/enabled')
}

// 6. 获取-角色详情
export const reqGetRoleDetail = (id) => {
  return request.get(`/sys/role/${id}`)
}

// 7. 分配权限-角色
export const reqAssignPermission = (data) => {
  return request.put('/sys/role/assignPrem', data)
}
